package com.itheima.day08;
/*
案例4: 字符串的遍历(2中方法遍历:)
 */

import java.util.Scanner;

public class TestClassCase04 {
    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);
        System.out.println("请输入字符串:");
        String str=sc.nextLine();


        for (int i = 0; i < str.length(); i++) {

            System.out.print(str.charAt(i)+" ");

        }

        System.out.println();
        System.out.println("----------");

        char[]  ch=str.toCharArray();

        for (int i = 0; i < ch.length; i++) {
            System.out.print(ch[i]+" ");
        }


    }
}
